package edu.nf.identification.common.exception;


import edu.nf.identification.common.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice("edu.nf.identification.controller")
@Slf4j
public class GlobalExceptionAdvice {

    @ExceptionHandler(GlobalException.class)
    public ResultVO<?> handleGlobalException(GlobalException e) {
        log.error("远程接口调用异常", e);
        return new ResultVO<>(e.getErrorCode(), e.getMessage(),null);
    }

    @ExceptionHandler(Exception.class)
    public ResultVO<?>  handleGlobalException(Exception e) {
        log.error("服务器异常", e);
        return new ResultVO<>(500,"服务器繁忙，请稍后尝试",null);
    }
}